package com.tyk.bookstore.front.product.controller;

import com.tyk.bookstore.front.common.core.model.query.SuggestionQuery;
import com.tyk.bookstore.front.common.core.model.result.R;
import com.tyk.bookstore.front.common.core.model.vo.SuggestionVo;
import com.tyk.bookstore.front.product.service.PublisherService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author tyk
 * @description 出版社管理
 */
@RequestMapping({"api/product/publisher"})
@Tag(name = "商品管理/出版社管理", description = "出版社管理")
@RestController
@RequiredArgsConstructor
public class PublisherController {

    private final PublisherService publisherService;

    @GetMapping({"suggest"})
    @Operation(summary = "出版社搜索建议列表", description = "出版社搜索建议列表")
    public R<List<SuggestionVo>> getSuggestionList(
            @Validated @ParameterObject SuggestionQuery query
    ) {
        return R.ok(publisherService.getSuggestionList(query));
    }

}
